/**
 * 报表设计公司(2011)
 */
package com.reportgear.designer.action;

import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.SwingUtilities;

import net.abbp.report.view.GridView;


/**
 * 支持撤销的 Action
 * 
 * @version 1.0 2011-3-24
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 */
public abstract class UndoableAction extends ReportAction {

	public abstract boolean executeAction(EventObject evt);

	public void actionPerformed(ActionEvent evt) {
		executeUndoAction(evt);
	}

	protected void executeUndoAction(EventObject evt) {
		final GridView workSheet = getGridView();
		if (workSheet == null) {
			return;
		}
		boolean status = executeAction(evt);
		if (status) {
			// reportPane.fireReportDataChanged();
			// reportPane.undoRecord();
		}
		SwingUtilities.invokeLater(new Runnable() {

			public void run() {
				workSheet.setFocus();
			}
		});
	}
}